home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
315
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
2KB
Path: sundog.tiac.net!stanr
From: stanr@tiac.net (Stan Ryckman)
Newsgroups: comp.std.c
Subject: Re: Question on 'getopt'
Date: 7 Feb 1996 03:49:16 GMT
Organization: Amber & Sneakers Fan Club
Message-ID: <4f97fs$s47@sundog.tiac.net>
References: <1996Feb5.225706.10082@tmai.com>
NNTP-Posting-Host: sunspot.tiac.net
In article <1996Feb5.225706.10082@tmai.com>,
Sridhar Panchapakesan <sridharp> wrote:
:This is a multi-part message in MIME format.
If you can avoid posting in MIME, please do so. Some can't read it.
Also, your post doesn't have a replyable email address. Seems like
you could use some new software.
[snip]
:I am trying to use 'getopt' to read a quoted string as options for a
:program. It works fine when I try it from a shell (csh) but when I try
:running it from a script using 'exec' it does not accept the entire the
:entire quoted string as the option.
:
:e.g. ( test is the program name)
:% test -f "-g -o 5" in.txt
:( getopt works fine. The string "-g -o 5" is read correctly into
:optargs. Note that I have to use '-' (dash) in the string as a
:requirement of the program itself.)
:
:However when I try it from the script file:
:
:exec test -f "\"-g -o 5\"" in.txt
:
:The getopt only recognizes "-g as the option for -f instead of "-g -o
:5".
:
:I would appreciate any help in this area..
Well, since it works fine in the first case, you don't seem to have a
C problem but rather a shell problem. Maybe you couldn't tell that,
so I won't flame you. (This time :-)
I would suggest you try comp.unix.shell. Also, give them the
results of the "uname -a" command in case it's a system-related thing.
Other: they will probably tell you to use sh scripts, not csh, because
csh is buggy. They will be right. Also, try to use some other name
than "test" since "test" is a UNIX command and that possibility adds
to the confusion.
Good luck. Now back to C standards issues (we hope).
Cheers,
Stan.
--
Stan Ryckman (stanr@tiac.net) (new e-mail address)